package models_main

import (
	"fmt"
	"longmen/server/pkg/db/mysql/models"
	"longmen/server/pkg/db/mysql/models/models_live"
)

type UserReservation struct {
	ID              int    `json:"id" gorm:"-;primary_key;AUTO_INCREMENT"`
	UserID          int    `json:"user_id"`           //int(10)
	UserType        int    `json:"user_type"`         //tinyint(1) DEFAULT '0' COMMENT '0: 普通用户, 1: 主播用户'
	LiveTime        int64  `json:"live_time"`         // 预约开播时间
	UserNickname    string `json:"user_nickname"`     //varchar(255) COMMENT '用户昵称'
	UserAvatar      string `json:"user_avatar"`       //varchar(255) COMMENT '用户头像'
	MatchID         int    `json:"match_id"`          //int(10)
	MatchEventTitle string `json:"match_event_title"` //varchar(255) COMMENT '联赛名称'
	MatchTime       int    `json:"match_time"`        //int(11) COMMENT '开赛具体时间'
	MatchDate       string `json:"match_date"`        //int(11) COMMENT '开赛日期'
	HomeTeamName    string `json:"home_team_name"`    //varchar(255) COMMENT '主队名称'
	HomeTeamLogo    string `json:"home_team_logo"`    //varchar(255) COMMENT '主队图标'
	AwayTeamName    string `json:"away_team_name"`    //varchar(255) COMMENT '客队名称'
	AwayTeamLogo    string `json:"away_team_logo"`    //varchar(255) COMMENT '客队图标'
	SportType       string `json:"sport_type"`        //varchar(255) COMMENT 'football,basket,tennis'
	CreatedAt       int64  `json:"created_at"`
	// 直播信息
	Lives []struct {
		AnchorAvatar string `json:"anchor_avatar"` // 主播头像
		models_live.Live
	} `gorm:"-" json:"lives"`
}

func (UserReservation) TableName() string {
	return fmt.Sprintf("%suser_reservation", models.Prefix)
}
